package top.lishuoboy.hibernate.validator.a1hello;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/** 1.2. 添加约束 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Accessors(chain = true)
public class Car {

    /** 制造商 */
    //永远不能为null
    @NotNull
    private String manufacturer;

    /** 车牌 */
    //永远不能为null,并且它的值字符串的长度要在2到14之间
    @NotNull
    @Size(min = 2, max = 14)
    private String licensePlate;

    /** 座位数 */
    //值不能小于2
    @Min(2)
    private int seatCount;

}